package days29.Title100;

class Solution {
    public boolean isSameTree(TreeNode p, TreeNode q) {
        if (p==null){
            return q == null;
        }
        if (q==null){
            return false;
        }
        if (p.val!=q.val)
            return false;
        if (isSameTree(p.left,q.left))
            if (isSameTree(p.right,q.right))
                return true;
        return false;
    }
}